package com.xuecheng.content.feignclient;

import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;

/**
 * ClassName: MediaServiceFallbackFactory
 * Package: com.xuecheng.content.feignclient
 * Description:
 *
 * @Author Endeavor-ZQB
 * @Create 2023/2/13 2:18
 * @Version 1.0
 */
@Slf4j
@Component
public class MediaServiceFallbackFactory implements FallbackFactory<MediaServiceClient> {
    @Override
    public MediaServiceClient create(Throwable throwable) {
        return new MediaServiceClient() {
            @Override
            public String upload(MultipartFile filedata, String folder, String objectName) {
                throwable.getStackTrace();
                log.debug("远程调用媒资管理服务时，熔断异常:{}",throwable.getMessage());
                return null;
            }
        };
    }
}
